package DAO;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class ExpenseDao {

	@Autowired
	JdbcTemplate jdbcTemplate;
	
	/**
	 * 查询快递网点是否被授权
	 * @param branchID
	 * @param expressID
	 * @return
	 */
	public boolean isExpressAuthed(int branchID,int expressID){
		String sql="select count(expense_id) from expense where expense_branch_id=?" +
				" and expense_express_id=?" +
				" and expense_checked=1;";
		Object[] params=new Object[]{branchID,expressID};
		int result=jdbcTemplate.queryForInt(sql,params);
		if(result==0){
			return false;
		}else{
			return true;
		}
	}
}
